#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 22 14:39:02 2019
BS
openclose
pricetype

cmd_oncall=["onpos","onorder","onfund","ontrade"]
@author: jili
"""
BS={"b":["b","buy","long"],"s":["s","sell","short"]}
adapter_subjects={
    "ctp":{"up":"ctp_up","down":"ctp_down"},
    "xtp":{"up":"xtp_up","down":"xtp_down"},
    "sim":{"up":"sim_up","down":"sim_down"}
}
trade_subjects={"onpos":"onpos","onfund":"onfund","onorder":"onorder"}
"""
General constant string used in VN Trader.
"""
class bs():
    """
    bs/Direction of order/trade/position.
    """
    buy = "buy"#多
    sell = "sell"#空
    net = "net"#净


class openclose():
    """
    openclose/Offset of order/trade.
    """
    none = ""
    open = "open"
    close = "close"
    closetoday = "closetoday"
    closeyesterday= "closeyesterday"


class status:
    """
    Order status.
    """
    submitting = "submitting"#提交中
    working = "working"#未成交/挂单中
    parttraded ="parttraded"## "部分成交"
    alltraded = "alltraded"#"全部成交"
    canceled = "canceled"#"已撤销"
    rejected = "rejected"#"拒单"


class product():
    """
    Product class.
    """
    EQ = "股票"
    future = "期货"
    option = "期权"
    INDEX = "指数"
    FOREX = "外汇"
    SPOT = "现货"
    ETF = "ETF"
    bond = "债券"
    WARRANT = "权证"
    spread = "价差"
    fund = "基金"


class ordertype():
    """
    Order type.
    """
    limit = "limit"
    market = "market"
    stop = "STOP"
    FAK = "FAK"
    FOK = "FOK"


class optiontype():
    """
    Option type.
    """
    call = "call"
    put = "put"


class market():
    """
    Exchange.
    """
    # Chinese
    CFFEX = "CFFEX"         # China Financial Futures Exchange
    SHFE = "SHFE"           # Shanghai Futures Exchange
    CZCE = "CZCE"           # Zhengzhou Commodity Exchange
    DCE = "DCE"             # Dalian Commodity Exchange
    INE = "INE"             # Shanghai International Energy Exchange
    SSE = "SSE"             # Shanghai Stock Exchange
    SZSE = "SZSE"           # Shenzhen Stock Exchange
    SGE = "SGE"             # Shanghai Gold Exchange
    """
    WXE = "WXE"             # Wuxi Steel Exchange

    # Global
    SMART = "SMART"         # Smart Router for US stocks
    NYMEX = "NYMEX"         # New York Mercantile Exchange
    COMEX = "COMEX"         # a division of theNew York Mercantile Exchange
    GLOBEX = "GLOBEX"       # Globex of CME
    IDEALPRO = "IDEALPRO"   # Forex ECN of Interactive Brokers
    CME = "CME"             # Chicago Mercantile Exchange
    ICE = "ICE"             # Intercontinental Exchange
    SEHK = "SEHK"           # Stock Exchange of Hong Kong
    HKFE = "HKFE"           # Hong Kong Futures Exchange
    HKSE = "HKSE"           # Hong Kong Stock Exchange
    SGX = "SGX"             # Singapore Global Exchange
    CBOT = "CBT"            # Chicago Board of Trade
    CBOE = "CBOE"           # Chicago Board Options Exchange
    CFE = "CFE"             # CBOE Futures Exchange
    DME = "DME"             # Dubai Mercantile Exchange
    EUREX = "EUX"           # Eurex Exchange
    APEX = "APEX"           # Asia Pacific Exchange
    LME = "LME"             # London Metal Exchange
    BMD = "BMD"             # Bursa Malaysia Derivatives
    TOCOM = "TOCOM"         # Tokyo Commodity Exchange
    EUNX = "EUNX"           # Euronext Exchange
    KRX = "KRX"             # Korean Exchange

    OANDA = "OANDA"         # oanda.com

    # CryptoCurrency
    BITMEX = "BITMEX"
    OKEX = "OKEX"
    HUOBI = "HUOBI"
    BITFINEX = "BITFINEX"
    BINANCE = "BINANCE"
    BYBIT = "BYBIT"         # bybit.com
    COINBASE = "COINBASE"
    DERIBIT = "DERIBIT"
    GATEIO = "GATEIO"
    BITSTAMP = "BITSTAMP"

    # Special Function
    LOCAL = "LOCAL"         # For local generated data
    """



class Currency():
    """
    Currency.
    """
    USD = "USD"
    HKD = "HKD"
    CNY = "CNY"


class Interval():
    """
    Interval of bar data.
    """
    min = "1m"
    hour = "1h"
    day = "d"
    weekly = "w"
